package src.search;

import java.util.ArrayList;
import java.util.List;

/**
 * @author FengBaiyu
 */
public class Lc_nubmer_clock
{
    static int[][] time = {{0}, {1, 2, 4, 8, 16, 32}, {3, 5, 6, 9, 10, 12, 17, 18, 20, 24, 33, 34, 36, 40, 48},
        {7, 11, 13, 14, 19, 21, 22, 25, 26, 28, 35, 37, 38, 41, 42, 44, 49, 50, 52, 56},
        {15, 23, 27, 29, 30, 39, 43, 45, 46, 51, 53, 54, 57, 58}, {31, 47, 55, 59}};

    public static void main(String[] args)
    {

        System.out.println(readBinaryWatch(1));
    }

    public static List<String> readBinaryWatch(int turnedOn)
    {

        List<String> list = new ArrayList<>();
        for (int i = 0; i < 4; i++)
        {
            for (int j = 0; j < time[i].length; j++)
            {
                if (time[i][j] < 12)
                {
                    if ((turnedOn - i) < time.length && (turnedOn - i) >= 0)
                    {
                        for (int k = 0; k < time[turnedOn - i].length; k++)
                        {
                            StringBuilder stringBuilder = new StringBuilder();
                            if (time[turnedOn - i][k] < 10)
                            {
                                stringBuilder.append(time[i][j]);
                                stringBuilder.append(":0");
                                stringBuilder.append(time[turnedOn - i][k]);
                                list.add(stringBuilder.toString());
                            }
                            else
                            {
                                stringBuilder.append(time[i][j]);
                                stringBuilder.append(":");
                                stringBuilder.append(time[turnedOn - i][k]);
                                list.add(stringBuilder.toString());
                            }

                        }
                    }
                }

            }
        }
        return list;

    }
}
